package zhongbo.java.air.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;


@Component
public class RedisLogChanelPublisher {

    private static final String INJEST_FLIGHT_PATH = "injest_flight_path_tang_guo_zheng";

    @Autowired
    private RedisTemplate<String,Object> redisTemplate;


    @Bean
    RedisLogChanelPublisher createRedisLogChanelPublisher() {
        return new RedisLogChanelPublisher();
    }

    /**
     * 发布消息
     */
    public void broadcast(String message) {
        redisTemplate.convertAndSend(INJEST_FLIGHT_PATH,message);
    }

    public void broadcast(String ip,String message){
        redisTemplate.convertAndSend(ip,message);
    }
}